#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.biz.util;

import java.util.Collection;
import java.util.Map;

/**
 * Created by foodoon on 15/9/4.
 */
public class CollectionUtil {

    public static boolean has(Object collection,Object key){
        if(collection == null || key == null){
            return false;
        }
        if(collection instanceof Collection){
            return ((Collection) collection).contains(key);
        }
        if(collection instanceof Map){
            return ((Map) collection).containsKey(key);
        }
        if(collection.getClass().isArray()){
            Object[] array = (Object[])collection;
            for(Object obj :array){
                if(obj!= null && String.valueOf(obj).equals(String.valueOf(key))){
                    return true;
                }
            }
        }
        return false;
    }
}
